//
//  PersonalController.m
//  NormalFramework
//
//  Created by beisheng03 on 2018/3/12.
//  Copyright © 2018年 beisheng. All rights reserved.
//

#import "PersonalController.h"
#import "PersonalHeaderCell.h"
#import "PersonalJumpCell.h"
@interface PersonalController ()

@end

@implementation PersonalController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([PersonalHeaderCell class]) bundle:nil] forCellReuseIdentifier:[PersonalHeaderCell identifierStr]];
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([PersonalJumpCell class]) bundle:nil] forCellReuseIdentifier:[PersonalJumpCell identifierStr]];

    self.tableView.estimatedSectionHeaderHeight = 0;
    self.tableView.estimatedSectionFooterHeight = 8;
    self.tableView.tableFooterView = [[UIView alloc]init];
    
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    if (@available(iOS 11.0, *)) {
        
        
    self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        
    }
    
}


- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 4;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    if (section == 0) {
        return 4;
    } else if (section == 1) {
        return 2;
    }else if (section == 2) {
        return 1;
    }else{
        return 1;
        
    }
    
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (indexPath.section == 0 && indexPath.row == 0) {
        PersonalHeaderCell *cell = [tableView dequeueReusableCellWithIdentifier:[PersonalHeaderCell identifierStr]];
        
        
        return cell;
    } else {
        PersonalJumpCell *cell = [tableView dequeueReusableCellWithIdentifier:[PersonalJumpCell identifierStr]];
        
        
        return cell;
    }
    
    
   
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.section == 0 && indexPath.row == 0) {
       
        
        return 200;
        
    } else {
      
        
        return 52;
    }
    
    
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    
    return 8;
}


- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    
    return 0.00001;
}


- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    
    return  [[UIView alloc]init];
}


- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    return  [[UIView alloc]init];
    
}

@end
